/*
	purpose:
		used in the cart pages
	page:
		/cart/checkout_billing.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckBillingForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.billingfirstname.value))
	{
		alert("Please enter a valid billing first name.");
		theform.billingfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billinglastname.value))
	{
		alert("Please enter a valid billing last name.");
		theform.billinglastname.focus();
		return false;
	}
	
	if (!IsEmail(theform.billingemail.value))
	{
		alert("Please enter a valid billing email address.");
		theform.billingemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.billingemailconfirm.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.billingemailconfirm.focus();
		return false;
	}
	
	if (theform.billingemail.value != theform.billingemailconfirm.value)
	{
		alert("Sorry, your billing email and confirmation email are not the same.");
		theform.billingemailconfirm.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingaddress.value))
	{
		alert("Please enter a valid billing address.");
		theform.billingaddress.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingcity.value))
	{
		alert("Please enter a valid billing city.");
		theform.billingcity.focus();
		return false;
	}

	if (theform.billingstateid[theform.billingstateid.selectedIndex].value == "")
	{
		alert("Please select a valid state/province.");
		theform.billingstateid.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.billingpostal.value))
	{
		alert("Please enter a valid billing postal/zip code.");
		theform.billingpostal.focus();
		return false;
	}

	if (!IsPhone(theform.billingphone.value))
	{
		alert("Please enter a valid billing phone number.");
		theform.billingphone.focus();
		return false;
	}
	
	theform.submit();
}

/*
	purpose:
		used in the contact page
	page:
		/contact_us/more_information.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckContactForm(theform)
{
	
	if (trim(theform.contactlastname.value) == '')
	{
		alert("Please enter your last name.");
		theform.contactlastname.focus();
		return false;
	}

	if (trim(theform.contactaddress.value) == '')
	{
		alert("Please enter your address.");
		theform.contactaddress.focus();
		return false;
	}
	
	if (trim(theform.contactcity.value) == '')
	{
		alert("Please enter your city.");
		theform.contactcity.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}	

	if (!IsPhone(theform.contactphone.value))
	{
		alert("Please enter a valid phone number.");
		theform.contactphone.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactemail.value))
	{
		alert("Please enter a valid email address.");
		theform.contactemail.focus();
		return false;
	}
	
	if (!IsEmail(theform.contactconfirmemail.value))
	{
		alert("Please enter a valid confirmation email address.");
		theform.contactconfirmemail.focus();
		return false;
	}
	
	if (theform.contactemail.value != theform.contactconfirmemail.value)
	{
		alert("Your email address and confirmation email address do not match.");
		theform.contactconfirmemail.focus();
		return false;
	}
	
	//theform.submit();
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/dealer/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckDealerForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.dealercompanyname.value))
	{
		alert("Please enter a valid company name.");
		theform.dealercompanyname.focus();
		return false;
	}
	
	if (!IsUsername(theform.dealerusername.value))
	{
		alert("Please enter a valid username.");
		theform.dealerusername.focus();
		return false;
	}

	if ((theform.updatepassword.checked == 1) || (theform.submit_type.value == "add"))
	{
		if (!IsPassword(theform.dealerpassword.value))
		{
			alert("Please enter a valid password.");
			theform.dealerpassword.focus();
			return false;
		}
		
		if (!IsPassword(theform.dealerpasswordconfirm.value))
		{
			alert("Please enter a valid password confirmation password.");
			theform.dealerpasswordconfirm.focus();
			return false;
		}
	 	
		if (theform.dealerpassword.value != theform.dealerpasswordconfirm.value)
		{
		 	alert ("You Password and Confirm Password do not match");
			theform.dealerpasswordconfirm.focus();
			return false;
		}
	}

	
	if (!IsWordSpace(theform.dealerfirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.dealerfirstname.focus();
		return false;
	}
	
	if (!IsWordSpace(theform.dealerlastname.value))
	{
		alert("Please enter a valid last name.");
		theform.dealerlastname.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.dealeraddress.value))
	{
		alert("Please enter a valid address.");
		theform.dealeraddress.focus();
		return false;
	}
	
	if (theform.dealeraddress2.value.length > 0)
	{
		if (!IsWordNumberSpecial(theform.dealeraddress2.value))
		{
			alert("Please enter a valid address 2 value.");
			theform.dealeraddress2.focus();
			return false;
		}
	}
	
	if (!IsWordNumberSpecial(theform.dealercity.value))
	{
		alert("Please enter a valid city value.");
		theform.dealercity.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.dealerpostal.value))
	{
		alert("Please enter a valid zip/postal code value.");
		theform.dealerpostal.focus();
		return false;
	}
	
	if (theform.dealeremail.value.length < 5)
	{
		alert("Please enter a valid email address.");
		theform.dealeremail.focus();
		return false;
	}

	if (!IsPhone(theform.dealerphone.value))
	{
		alert("Please enter a valid phone number. I.e. xxx-xxx-xxxx OR xxx-xxx-xxxx ext xxx");
		theform.dealerphone.focus();
		return false;
	}

	if (!IsPhone(theform.dealerfax.value))
	{
		alert("Please enter a valid fax number. I.e. xxx-xxx-xxxx");
		theform.dealerfax.focus();
		return false;
	}
		
	if (theform.dealerbusinesstype[theform.dealerbusinesstype.selectedIndex].value == "")
	{
		alert("Please select your business type.");
		theform.dealerbusinesstype.focus();
		return false;
	}
	
	
	if (!IsWordNumberSpecial(theform.dealeryearsinbusiness.value))
	{
		alert("Please enter your years in business.");
		theform.dealeryearsinbusiness.focus();
		return false;
	}
	
	if (theform.dealerregistrationnumber.value.length < 3)
	{
		alert("Please enter your Business Registration Number.");
		theform.dealerregistrationnumber.focus();
		return false;
	}
		
		
	if (!CheckDate(theform,'expiry','Expiration Date',1))
		return false;
		
	return true;
}


/*
	purpose:
		used in the contact page
	page:
		/login/jf_login_dealer_sign_up.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckDealerInquiryForm(theform)
{


	if (trim(theform.dealerinquirycompany.value) == '')
	{
		alert("Please enter your company name.");
		theform.dealerinquirycompany.focus();
		return false;
	}
	
	

	if (trim(theform.dealerinquirylastname.value) == '')
	{
		alert("Please enter your contact last name.");
		theform.dealerinquirylastname.focus();
		return false;
	}

	
		
	if (trim(theform.dealerinquiryaddress.value) == '')
	{
		alert("Please enter your address.");
		theform.dealerinquiryaddress.focus();
		return false;
	}
	
	if (trim(theform.dealerinquirycity.value) == '')
	{
		alert("Please enter your city.");
		theform.dealerinquirycity.focus();
		return false;
	}
	
	if (theform.countryid[theform.countryid.selectedIndex].value == "")
	{
		alert("Please select a valid country.");
		theform.countryid.focus();
		return false;
	}
	
	if (!IsPhone(theform.dealerinquiryphone.value))
	{
		alert("Please enter a valid phone number.");
		theform.dealerinquiryphone.focus();
		return false;
	}

	if (!IsEmail(theform.dealerinquiryemail.value))
	{
		alert("Please enter a valid email address.");
		theform.dealerinquiryemail.focus();
		return false;
	}
		
	return true;
}
		
/*
	purpose:
		used in the wishlist, tell a friend form
	page:
		/wishlist/email_a_customer.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckEmailWishlistForm(theform)
{

		
	if (!IsWordNumberSpecial(theform.recipient_name.value))
	{
		alert("Please enter your customers name.");
		theform.recipient_name.focus();
		return false;
	}

	if (!IsEmail(theform.recipient_email.value))
	{
		alert("Please enter your customers email address.");
		theform.recipient_email.focus();
		return false;
	}
	
	
	return true;
}

/*
	purpose:
		used in the control panel
	page:
		/admin/gallery/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckGalleryForm(theform)
{

	if (!IsWordSpecial(theform.galleryname.value))
	{
		alert("Please enter a valid gallery name.");
		theform.galleryname.focus();
		return false;
	}

	return true;
}


/*
	purpose:
		used in the front end 
	page:
		/bin/cf_display_header_navigation.cfm
	Parameters:
		theform - object reference to the form being passed
*/
function CheckKeywordSearchForm(theform)
{
	//by martin 2011 -01-17
	/*if (!IsWordNumberSpecial(theform.searchtext.value))
	{
		alert("Please enter a valid keyword.");
		alert("输入搜寻关键字.");
		theform.searchtext.focus();
		return false;
	}*/
	
	
	return true;
}




/*
	purpose:
		used in the login section
	page:
		/login/forgot_password.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckDealerForgotPasswordForm(theform)
{
	
	if (!IsEmail(theform.dealeremailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.dealeremailaddress.focus();
		return false;
	}
	
	return true;
}



/*
	purpose:
		used in the front of site
	page:
		/login/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckDealerLoginForm(theform)
{

	if (theform.dealerusername.value.length < 5)
	{
		alert("Please enter a valid username.");
		theform.dealerusername.focus();
		return false;
	}

	if (!IsPassword(theform.dealerpassword.value))
	{
		alert("Please enter a valid password. (MIN. 5 characters)");
		theform.dealerpassword.focus();
		return false;
	}

	theform.submit();
}


/*
	purpose:
		used in the front of site
	page:
		/login/edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/


function CheckMyAccountInformationForm(theform)
{
	if (!IsPassword(theform.loginpassword.value))
	{
		alert("Please enter a valid password. (MIN. 5 characters)");
		theform.loginpassword.focus();
		return false;
	}

	if (theform.loginpassword.value != theform.loginpasswordconfirm.value)
	{
		alert("Sorry, your password and confirmation password values are not the same.");
		theform.loginpasswordconfirm.focus();
		return false;
	}

	theform.submit();
}




/*
	purpose:
		used in the newsletter signup section
	page:
		/newsletter/index.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckNewsletterSignupForm(theform)
{
	
	if (!IsWordNumberSpecial(theform.newsletterfirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.newsletterfirstname.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.newsletterlastname.value))
	{
		alert("Please enter a valid last name.");
		theform.newsletterlastname.focus();
		return false;
	}
	
	if (!IsEmail(theform.newsletteremail.value))
	{
		alert("Please enter a valid email address.");
		theform.newsletteremail.focus();
		return false;
	}
	
	if (!IsEmail(theform.newsletteremailconfirm.value))
	{
		alert("Please enter a valid confirm email address.");
		theform.newsletteremailconfirm.focus();
		return false;
	}
	
	if ((theform.newsletteremail.value) != (theform.newsletteremailconfirm.value))
	{
		alert("Your email and confirmation email address are not the same.");
		theform.newsletteremail.focus();
		return false;
	}
	
	if (!theform.newsletterconfirm.checked)
	{
		alert("Please indicate that you would like to receive our newsletter.");
		theform.newsletterconfirm.focus();
		return false;
	}
	
	return true;
}

/*
	purpose:
		used in the payment page
	page:
		/cart/review_payment.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckPaymentForm(theform)
{

	/*
	//if they have entered a promotional code
	if(theform.promotionalcode.value.length > 0)
	{
		if (!IsPromotionalCode(theform.promotionalcode.value))
		{
			alert("Please enter the a valid promotional code.");
			theform.promotionalcode.focus();
			return false;
		}
	}

	//check if they selected a gift message
	if(theform.GiftYes.checked == true)
	{
		//check recipient name
		if (!IsWordNumberSpecial(theform.giftrecipient.value))
		{
			alert("Please enter the name on the recipient.");
			theform.giftrecipient.focus();
			return false;
		}
		
		//check sender name
		if (!IsWordNumberSpecial(theform.giftsender.value))
		{
			alert("Please enter the sender name.");
			theform.giftsender.focus();
			return false;
		}
		
		//check length of message
		if (theform.giftmessage.value.length > 75)
		{
			alert("Please enter a shorter message, 75 characters maximum.");
			theform.giftmessage.focus();
			return false;
		}
		
		//check message format
		if (!IsDescription(theform.giftmessage.value))
		{
			alert("Please enter the message for your gift card.");
			theform.giftmessage.focus();
			return false;
		}
	}
	else
	{
		//check if they have entered any values, if so prompt them to select a gift message
		if ((theform.giftrecipient.value.length > 0) || (theform.giftsender.value.length > 0) || (theform.giftmessage.value.length > 0))
		{
			alert("Please check the box indicating you wish to send a gift message, and fill out the appropriate fields.");
			theform.GiftYes.focus();
			return false
		}
	}


	//if they have entered a GiftCard Number
	if(theform.giftcardnumber.value.length > 0)
	{
		if (!IsGiftCard(theform.giftcardnumber.value))
		{
			alert("Please enter the a valid GiftCard number.");
			theform.giftcardnumber.focus();
			return false;
		}
	}
	*/
	
	//check the credit card number
	if (!CheckCardNumber(theform))
		return false;
	
	/*
	//check card authentication code
	if (!IsCardAuthentication(theform.CardAuthentication.value))
	{
		alert("Please enter the three digit authentication code found on the back of your credit card.");
		theform.CardAuthentication.focus();
		return false;
	}
	*/
	
	//check cc_name
	if (!IsWordNumberSpecial(theform.nameoncard.value))
	{
		alert("Please enter the name on your credit card.");
		theform.nameoncard.focus();
		return false;
	}
	
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/photo/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckPhotoForm(theform)
{
	var thumbnail_value="";
	var image_value="";
	
	if (!IsWordNumber(theform.photoname.value))
	{
		alert("Please enter a valid Photo Name.");
		theform.photoname.focus();
		return false;
	}
	
	if (!IsDescription(theform.photodescription.value))
	{
		alert("Please enter some valid Photo Description.");
		theform.photodescription.focus();
		return false;
	}

	//if we are supposed to upload an thumbnail
	if (theform.uploadthumbnail.value == 1)
	{
		thumbnail_value=theform.photothumbnail_file.value;
		
		if (!IsImageExtension(thumbnail_value.substring(thumbnail_value.lastIndexOf("."),thumbnail_value.length)))
		{
			alert("Please select an thumbnail file for uploading (must be .jpg or .gif).");
			theform.photothumbnail_file.focus();
			return false;
		}
	}
						
	//if we are supposed to upload an image
	if (theform.uploadimage.value == 1)
	{
	 	image_value=theform.photoimage_file.value;
		
		if (!IsImageExtension(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select an image file for uploading (must be .jpg or .gif).");
			theform.photoimage_file.focus();
			return false;
		}
	}
						
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/product/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckProductForm(theform)
{
	var thumbnail_value="";
	var image_value="";
	var number_items_selected=0;
	
	if (!IsWordNumberSpecial(theform.productnumber.value))
	{
		alert("Please enter a valid product number.");
		theform.productnumber.focus();
		return false;
	}
	
	if (!IsWordNumberSpecial(theform.productname.value))
	{
		alert("Please enter a valid product name.");
		theform.productname.focus();
		return false;
	}
	
	//ensure they selected at least one category
	for (var i=0;i<theform.categoryid.length;i++)
	{
		if (theform.categoryid[i].selected == 1)
			number_items_selected++;
	}
	
	if (number_items_selected == 0)
	{
		alert("Please select at least one category for this product.");
		theform.categoryid[0].focus();
		return false;
	}
	
	//if they have entered a canadian price
	if (theform.productpricecdn.value.length > 0)
	{
		if (!IsPrice(theform.productpricecdn.value))
		{
			alert("Please enter a valid Canadian product price.");
			theform.productpricecdn.focus();
			return false;
		}
	}
	
	//if they have entered an american price
	if (theform.productpriceusa.value.length > 0)
	{
		if (!IsPrice(theform.productpriceusa.value))
		{
			alert("Please enter a valid American product price.");
			theform.productpriceusa.focus();
			return false;
		}
	}
	
	//if we are supposed to upload an thumbnail
	if (theform.uploadthumbnail.value == 1)
	{
		thumbnail_value=theform.productthumbnail_file.value;
		
		if (!IsImageExtension(thumbnail_value.substring(thumbnail_value.lastIndexOf("."),thumbnail_value.length)))
		{
			alert("Please select an thumbnail file for uploading (must be .jpg or .gif).");
			theform.productthumbnail_file.focus();
			return false;
		}
	}
						
	//if we are supposed to upload an image
	if (theform.uploadimage.value == 1)
	{
	 	image_value=theform.productimage_file.value;
		
		if (!IsImageExtension(image_value.substring(image_value.lastIndexOf("."),image_value.length)))
		{
			alert("Please select an image file for uploading (must be .jpg or .gif).");
			theform.productimage_file.focus();
			return false;
		}
	}
						
	return true;
}

/*
	purpose:
		used in the cart page
	page:
		/<sectionname>/product_detail.cfm
	Parameters:
		theform - object reference to the form being passed
		is_edit - if the user is editing a quantity, 
*/

function CheckProductDetailForm(theform, is_edit)
{

	if (is_edit)
	{
		if (theform.quantity[theform.quantity.selectedIndex].value == 0)
		{
			return confirm("Selecting a quantity of 0 will remove this item from your cart.  Do you wish to proceed?");
		}
	}
	else
	{
		if (theform.quantity[theform.quantity.selectedIndex].value == 0)
		{
			alert("Please select a quantity greater than 0.");
			theform.quantity.focus();
			return false;
		}
	}
	
	return true;
}



/*
	purpose:
		used in the checkout pages
	page:
		/cart/checkout_shipping.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckShippingForm(theform)
{

	if (theform.shippingaddresssame.checked == 0)
		{
		if (!IsWordNumberSpecial(theform.shippingfirstname.value))
		{
			alert("Please enter a valid shipping first name.");
			theform.shippingfirstname.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.shippinglastname.value))
		{
			alert("Please enter a valid shipping last name.");
			theform.shippinglastname.focus();
			return false;
		}
		
		/*
		if (!IsEmail(theform.shippingemail.value))
		{
			alert("Please enter a valid shipping email address.");
			theform.shippingemail.focus();
			return false;
		}
		
		if (!IsEmail(theform.shippingemailconfirm.value))
		{
			alert("Please enter a valid confirm email address.");
			theform.shippingemailconfirm.focus();
			return false;
		}
		
		if (theform.shippingemail.value != theform.shippingemailconfirm.value)
		{
			alert("Sorry, your shipping email and confirmation email are not the same.");
			theform.shippingemailconfirm.focus();
			return false;
		}
		*/
		
		if (!IsWordNumberSpecial(theform.shippingaddress.value))
		{
			alert("Please enter a valid shipping address.");
			theform.shippingaddress.focus();
			return false;
		}
		
		if (!IsWordNumberSpecial(theform.shippingcity.value))
		{
			alert("Please enter a valid shipping city.");
			theform.shippingcity.focus();
			return false;
		}
	
		if (theform.shippingstateid[theform.shippingstateid.selectedIndex].value == "")
		{
			alert("Please select a valid state/province.");
			theform.shippingstateid.focus();
			return false;
		}
	
		if (!IsWordNumberSpecial(theform.shippingpostal.value))
		{
			alert("Please enter a valid shipping postal/zip code.");
			theform.shippingpostal.focus();
			return false;
		}
	
		if (!IsPhone(theform.shippingphone.value))
		{
			alert("Please enter a valid shipping phone number.");
			theform.shippingphone.focus();
			return false;
		}
	}
	
	theform.submit();
}


/*
	purpose:
		used in the control panel
	page:
		/admin/category/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckCategoryForm(theform)
{
	if (!IsWordNumberSpecial(theform.categoryname.value))
	{
		alert("Please enter a valid category name.");
		theform.categoryname.focus();
		return false;
	}

	return true;
}


/*
	purpose:
		used in the control panel
	page:
		all /module_setorder.cfm pages
	Parameters:
		theform - object reference to the form being passed
*/
function CheckDisplayOrderForm(theform)
{
	if (theform.orderlist.value <= 0)
	{
		alert("The order has not changed, no update required.");
		return false;
	}

	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/group/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckGroupForm(theform)
{
	var test=false;
	
	if (!IsWordSpace(theform.groupinfoname.value))
	{
		alert("Please enter a valid group name.");
		theform.groupinfoname.focus();
		return false;
	}

	if (!IsDescription(theform.groupinfodescription.value))
	{
		alert("Please enter a valid group description.");
		theform.groupinfodescription.focus();
		return false;
	}
						
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		main control panel login page
	Parameters:
		theform - object reference to the form being passed
*/
function CheckLoginForm(theform)
{

	if (!IsUsername(theform.username.value))
	{
		alert("Please enter a valid username. (MIN. 5 characters)");
		theform.username.focus();
		return false;
	}

	if (!IsPassword(theform.password.value))
	{
		alert("Please enter a valid password. (MIN. 5 characters)");
		theform.password.focus();
		return false;
	}

	return true;
}


/*
	purpose:
		used in the control panel search lookkup pages
	page:
		/admin/search/module_viewall.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckSearchProductCode(theform)
{
	//check 
	if (theform.productcode.value.length < 2)
	{
		alert("Please enter the product number.");
		theform.productcode.focus();
		return false;
	}
	
	return true;
}


/*
	purpose:
		used in the control panel
	page:
		/admin/user/module_edit.cfm
	Parameters:
		theform - object reference to the form being passed
*/

function CheckUserForm(theform)
{
	
	if (!IsWordSpace(theform.userinfofirstname.value))
	{
		alert("Please enter a valid first name.");
		theform.userinfofirstname.focus();
		return false;
	}
	
	if (!IsWordSpace(theform.userinfolastname.value))
	{
		alert("Please enter a valid last name.");
		theform.userinfolastname.focus();
		return false;
	}

	if (!IsUsername(theform.userinfousername.value))
	{
		alert("Please enter a valid username.");
		theform.userinfousername.focus();
		return false;
	}

	if ((theform.updatepassword.checked == 1) || (theform.submit_type.value == "add"))
	{
		if (!IsPassword(theform.userinfopassword.value))
		{
			alert("Please enter a valid password.");
			theform.userinfopassword.focus();
			return false;
		}
		
		if (!IsPassword(theform.userinfopasswordconfirm.value))
		{
			alert("Please enter a valid password confirmation password.");
			theform.userinfopasswordconfirm.focus();
			return false;
		}
	 	
		if (theform.userinfopassword.value != theform.userinfopasswordconfirm.value)
		{
		 	alert ("You Password and Confirm Password do not match");
			theform.userinfopasswordconfirm.focus();
			return false;
		}
	}

	if (!IsWordSpace(theform.userinfojobtitle.value))
	{
		alert("Please enter a valid job title.");
		theform.userinfojobtitle.focus();
		return false;
	}
	
	if (!IsEmail(theform.userinfoemailaddress.value))
	{
		alert("Please enter a valid email address.");
		theform.userinfoemailaddress.focus();
		return false;
	}

	if (theform.groupinfoid.selectedIndex == -1)
	{
		alert("Please select at least one group.");
		theform.groupinfoid[0].focus();
		return false;
	}

	return true;
}

/*
	purpose:
		used in the cart page
	page:
		/cart/index.cfm
	Parameters:
		thecategory - product category
		thesubcateogry - product subcategory
		theorderdetailid - orderdetail id
		thepage - step in the checkout process hte person came from
		
*/
	
function RemoveItem(thecategory,thesubcategory,theorderdetailid,thepage)
{
	var delete_item=true;
	
	delete_item=confirm("Do you really want to remove this item from your cart?");
	
	if (delete_item)
		window.location.href="/form_action/cf_delete_from_cart.cfm?requesttimeout=5000&categoryid"+thecategory+"&subcategoryid="+thesubcategory+"&recordid="+theorderdetailid+"&from="+thepage;
}

/*
	purpose:
		used in the wishlist page
	page:
		/wishlist/index.cfm
	Parameters:
		theorderdetailid - wishlistorderdetail id
		thewishlistid - wishlistid
		thepage - step in the wishlist area user came from
*/
	
function RemoveWishListItem(theorderdetailid,thewishlistid,thepage)
{
	var delete_item=true;
	
	delete_item=confirm("Do you really want to remove this item from your wishlist?");
	
	if (delete_item)
		window.location.href="/form_action/cf_delete_from_wishlist.cfm?requesttimeout=5000&recordid="+theorderdetailid+"&wishlistid="+thewishlistid+"&from="+thepage;
}

/*
	purpose:
		used in the wishlist page
	page:
		/wishlist/index.cfm
	Parameters:
		thewishlistid - wishlistid
		thedealerid - dealerid
*/
	
function RemoveWishList(thewishlistid,thedealerid)
{
	var delete_item=true;
	
	delete_item=confirm("Do you really want to remove this wishlist?");
	
	if (delete_item)
		window.location.href="/form_action/cf_process_delete_wishlist.cfm?requesttimeout=5000&wishlistid="+thewishlistid+"&dealerid="+thedealerid;
}